package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProConfigText;
import com.huizu.project.service.IProConfigTextService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 手机号配置Controller
 * 
 * @author zhangmx
 * @date 2024-06-05
 */
@RestController
@RequestMapping("/project/proconfigtext")
public class ProConfigTextController extends BaseController
{
    @Autowired
    private IProConfigTextService proConfigTextService;

    /**
     * 查询手机号配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProConfigText proConfigText)
    {
        startPage();
        List<ProConfigText> list = proConfigTextService.selectProConfigTextList(proConfigText);
        return getDataTable(list);
    }

    /**
     * 导出手机号配置列表
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:export')")
    @Log(title = "手机号配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProConfigText proConfigText)
    {
        List<ProConfigText> list = proConfigTextService.selectProConfigTextList(proConfigText);
        ExcelUtil<ProConfigText> util = new ExcelUtil<ProConfigText>(ProConfigText.class);
        util.exportExcel(response, list, "手机号配置数据");
    }

    /**
     * 获取手机号配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:query')")
    @GetMapping(value = "/{configurationId}")
    public AjaxResult getInfo(@PathVariable("configurationId") String configurationId)
    {
        return success(proConfigTextService.selectProConfigTextByConfigurationId(configurationId));
    }

    /**
     * 新增手机号配置
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:add')")
    @Log(title = "手机号配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProConfigText proConfigText)
    {
        return toAjax(proConfigTextService.insertProConfigText(proConfigText));
    }

    /**
     * 修改手机号配置
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:edit')")
    @Log(title = "手机号配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProConfigText proConfigText)
    {
        return toAjax(proConfigTextService.updateProConfigText(proConfigText));
    }

    /**
     * 删除手机号配置
     */
    @PreAuthorize("@ss.hasPermi('project:proconfigtext:remove')")
    @Log(title = "手机号配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{configurationIds}")
    public AjaxResult remove(@PathVariable String[] configurationIds)
    {
        return toAjax(proConfigTextService.deleteProConfigTextByConfigurationIds(configurationIds));
    }
}
